//
//  PywCommonFactoryManager.m
//  PywCommonSDKDemo
//
//  Created by Ampaw on 2017/8/17.
//  Copyright © 2017年 Ampaw. All rights reserved.
//

#import "PywCommonFactoryManager.h"
#import "PywCommonPlatformInfo.h"

//渠道插件名称
#define CHANNLE_PLUGIN_NAME @"PywCommonPywLYSDKApi"

@implementation PywCommonFactoryManager

/**
 朋友玩 联运SDK渠道（母包）
 */
//static PywCommonPywLYSDKApi *pywLYManager = nil;
static id pywLYManager = nil;
+ (id)pywLYManager
{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
//        pywLYManager = [[PywCommonPywLYSDKApi alloc] init];
        pywLYManager = [PywCommonPywLYSDKApi class];
    });
    return pywLYManager;
}

/**
 三方渠道
 */
static id channelManager = nil;
+ (id)channelManager
{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
//        channelManager = [[PywCommonSQSDKApi alloc] init];
        channelManager = NSClassFromString(CHANNLE_PLUGIN_NAME);
//        channelManager = [[class alloc] init];
    });
    return channelManager;
}

/**
 朋友玩 联运SDK渠道（母包独立支付）
 */
static id pywSDKIndiePayManager = nil;
+ (id)pywSDKIndiePayManager
{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        pywSDKIndiePayManager = [PywCommonPywSDKIndiePayApi class];
    });
    return pywSDKIndiePayManager;
}

+ (NSInteger) channelCode{
    return [[PywCommonPlatformInfo sharedCommonPlatformInfo].channel_id integerValue];
}


#pragma mark - ClearCache
+ (void)clearCache
{
    [PywCommonPlatformInfo sharedCommonPlatformInfo].channel_uid = @"";
    [PywCommonPlatformInfo sharedCommonPlatformInfo].channel_token = @"";
    
    [PywCommonPlatformInfo sharedCommonPlatformInfo].gameid = @"";
    [PywCommonPlatformInfo sharedCommonPlatformInfo].gamekey = @"";
    [PywCommonPlatformInfo sharedCommonPlatformInfo].apisecret = @"";
    [PywCommonPlatformInfo sharedCommonPlatformInfo].common_account = @"";
    [PywCommonPlatformInfo sharedCommonPlatformInfo].common_cp_uid = @"";
    [PywCommonPlatformInfo sharedCommonPlatformInfo].common_token = @"";
    [PywCommonPlatformInfo sharedCommonPlatformInfo].common_channel_prod_id = @"";
    [PywCommonPlatformInfo sharedCommonPlatformInfo].common_channel_order_sn = @"";
    [PywCommonPlatformInfo sharedCommonPlatformInfo].common_channel_order_info = @"";
    [PywCommonPlatformInfo sharedCommonPlatformInfo].common_channel_order_price = @"";
    [PywCommonPlatformInfo sharedCommonPlatformInfo].rate = @"";
    
    [PywCommonPlatformInfo sharedCommonPlatformInfo].change_pkg = 0;
    [PywCommonPlatformInfo sharedCommonPlatformInfo].use_third_channel = NO;
    [PywCommonPlatformInfo sharedCommonPlatformInfo].isInitSuccess = false;
    [PywCommonPlatformInfo sharedCommonPlatformInfo].pyw_common_apiurl = @"";
    [PywCommonPlatformInfo sharedCommonPlatformInfo].pyw_channel_apiurl = @"";
    [PywCommonPlatformInfo sharedCommonPlatformInfo].pyw_pay_apiurl = @"";
}

@end
